<template>
  <div class="container">
    <div class="header">
      <h1>我的课表
        <a-dropdown>
          <span class="print-table" @click="printTable">
            课表导出 <a-icon type="down" />
          </span>
          <a-menu slot="overlay">
            <a-menu-item>
              <a-tooltip placement="right">
                <template slot="title">横向打印效果更好</template>
                <span @click="printTable">课表打印</span>
              </a-tooltip>
            </a-menu-item>
            <a-menu-item>
              <span @click="exportTable('png')">导出png</span>
            </a-menu-item>
            <a-menu-item>
              <span @click="exportTable('excel')">导出excel</span>
            </a-menu-item>
          </a-menu>

        </a-dropdown>
      </h1>

    </div>
    <course-table/>
  </div>
</template>

<script>
import courseTable from "@/components/courseTable";

export default {

  components: {
    courseTable
  },
  methods: {
    exportTable() {
      // 导出课表
      this.$message.info("功能正在开发")
    },
    printTable() {
      // 打印课表
      let subOutputRankPrint = document.getElementById('table');
      let newContent = subOutputRankPrint.innerHTML;
      let oldContent = document.body.innerHTML;
      document.body.innerHTML = newContent;
      window.print();
      window.location.reload();
      document.body.innerHTML = oldContent;
    },

  }
}

</script>

<style scoped src="./css/courseSearch.css"></style>
<style scoped src="./css/common.css"></style>